<template>
    <transition name="fade">
        <div class="header-detail">
            <div class="detail-wrapper">

                <div class="detail-main">
                    <h1 class="name">{{ Detailseller.name }}</h1>
                    <div class="star-warpper">
                        <div class="star-on" v-for="i in score" :key="i">
                        </div>
                        <div class="star-off" v-for="i in 5 - score" :key="i">
                        </div>
                    </div>
                </div>

                <div class="detail-content">
                    <div class="title">
                        <div class="line"></div>
                        <div class="text">优惠信息</div>
                        <div class="line"></div>
                    </div>
                    <div class="supports">
                        <div class="support" v-for="support in Detailseller.supports">
                            <SupportIcon :size="1" :type="support.type" />
                            <span class="text">{{ support.description }}</span>
                        </div>
                    </div>
                </div>
                <div class="detail-bulletin">
                    <div class="title">
                        <div class="line"></div>
                        <div class="text">公告</div>
                        <div class="line"></div>
                    </div>
                    <div class="bulletin">{{ Detailseller.bulletin }}</div>
                </div>
            </div>

            <div class="detail-close" @click.stop="closeDetail">x</div>
        </div>
    </transition>
</template>

<script>
import SupportIcon from '@/components/support-icon/Support-Icon.vue'


export default {

    data() {
        let score = Math.round(this.Detailseller.score)

        return {
            score,
        }
    },
    methods: {
        closeDetail() {//子父组件通讯
            this.$emit('closeDetail', false) //创建一个closeDetail事件
        }
    },
    props: {
        Detailseller: {
            type: Object,
            default: () => {
                return {}
            }
        },
    },
    components: {
        SupportIcon
    },
    computed: {

    }
}
</script>

<style lang="less" scoped>
@import '@/common/style/variable.less';
@import '@/common/style/mixin.less';

.header-detail {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: @color-background-s;
    color: @color-white;
    backdrop-filter: blur(10px);
    z-index: 999;

    &.fade-enter-from,
    &fade-leave-to {
        opacity: 0;
        background: @color-background;
    }

    &.fade-enter-active,
    &fade-leave-active {
        transition: all 0.5s ease;
    }

    .detail-close {
        width: 30px;
        height: 30px;
        position: fixed;
        bottom: 30px;
        left: 50%;
        margin-left: -15px;
        text-align: center;
        line-height: 30px;

    }

    .detail-main {
        margin-top: 64px;
        padding-bottom: 64px;

        .name {
            font-size: @fontsize-large;
            font-weight: bold;
            margin-bottom: 10px;
            text-align: center;
        }

        .star-warpper {
            display: flex;
            justify-content: center;
            align-items: center;

            .star-on {
                width: 40px;
                height: 38px;
                background-image: url();
            }

            .star-off {
                width: 40px;
                height: 38px;
                background-image: url();
            }
        }
    }

    .detail-content {
        .title {
            display: flex;
            margin: 18px 20px 24px;
            align-items: center;
            justify-content: center;

            .line {
                flex: 1;
                height: 1px;
                background-color: @color-white;
            }

            .text {
                font-size: @fontsize-medium;
                padding: 0 12px;
            }
        }

        .supports {
            margin: 0 auto;
            width: 80%;

            .support {
                margin-bottom: 10px;

                .text {
                    margin-left: 10px;
                }
            }
        }
    }

    .detail-bulletin {
        .title {
            display: flex;
            margin: 18px 20px 24px;
            align-items: center;
            justify-content: center;

            .line {
                flex: 1;
                height: 1px;
                background-color: @color-white;
            }

            .text {
                font-size: @fontsize-medium;
                padding: 0 12px;
            }
        }

        .bulletin {
            margin: 0 auto;
            width: 80%;
            font-size: @fontsize-medium;
            line-height: 24px;
        }
    }
}
</style>